package group2assignone.ucm.customer;

import group2assignone.model.Customer;
import group2assignone.ucm.UCController;
import group2assignone.view.OurView;
import group2assignone.view.customer.CustomerWelcomeView;

/**
 * Takes the customer back to the customer welcome view
 * @author group2
 */
public class UCCancelCust implements UCController {

    private OurView view;
    private Customer cust;

    /**
     * sets the customer and view, used for personalisation
     * @param cust
     * @param view
     */
    public UCCancelCust(Customer cust, OurView view) {
        this.cust = cust;
        this.view = view;
    }

    /**
     * Use Case: Cancel
     * 1. system exits current view
     * 2. system updates gui to the Customer welcome view
     */
    public void run() {
        CustomerWelcomeView gui = new CustomerWelcomeView(cust);
        gui.go();
        view.dispose();
    }
}
